package ink.lovejinhu.leetcode;

import java.util.Arrays;

/**
 * @author jinhu
 * created 2021-07-23 17:47
 */
public class Solution_0561 {
    /**
     * @param nums
     * @return
     */
    public int arrayPairSum(int[] nums) {
        Arrays.sort(nums);
        int max = 0;
        for (int i = nums.length - 2; i >= 0; i = i - 2) {
            max += nums[i];
        }
        return max;
    }

    public static void main(String[] args) {
        int[] res = {1, 4, 3, 2};
        Arrays.sort(res);
        for (int i = 0; i < res.length; i++) {
            System.out.println(res[i]);

        }
    }
}
